#!/bin/bash
echo "Installing and running RSpec tests on all supported Rubies..."

# Save current Ruby in use under RVM
CURRENT=`rvm current`

# Prints the name of the Ruby, sets it to use under RVM, installs, tests
function test_ruby {
  echo -e "\n\033[1m$2\033[0m"
  rvm use $1
  rake install
  rspec spec
}

# Run tests on these versions
test_ruby 1.8.7 "Ruby 1.8.7 (MRI)"
test_ruby 1.9.2 "Ruby 1.9.2 (MRI)"
test_ruby 1.9.3 "Ruby 1.9.3 (MRI)"
test_ruby jruby JRuby
test_ruby rbx Rubinius

# Restore original Ruby in use
rvm use $CURRENT
